package cn.kgc.tangcco.liahozhe.spring.c_property;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.kgc.tangcco.liahozhe.spring.action.UserAction;
import cn.kgc.tangcco.liahozhe.spring.pojo.User;

public class App {
	private ApplicationContext context = new ClassPathXmlApplicationContext("cn/kgc/tangcco/liahozhe/spring/c_property/bean.xml");
	private ApplicationContext context_p = new ClassPathXmlApplicationContext("cn/kgc/tangcco/liahozhe/spring/c_property/bean_p.xml");
	@Test
	public void test01() {
		System.out.println("----容器创建完成----");
		User user01 = (User) context.getBean("user01");
		System.out.println(user01.getName());
	}
	@Test
	public void test02() {
		System.out.println("----容器创建完成----");
		User user01 = (User) context.getBean("user02");
		System.out.println(user01.getName());
	}
	@Test
	public void test03() {
		UserAction userAction = new UserAction();
		userAction.addUser();
	}
	@Test
	public void test04() {
		UserAction userAction = (UserAction) context.getBean("userAction");
		userAction.addUser();
	}
	@Test
	public void test05() {
		UserAction userAction = (UserAction) context.getBean("userActionInnerBean");
		userAction.addUser();
	}
	@Test
	public void test06() {
		UserAction userAction = (UserAction) context_p.getBean("userAction");
		userAction.addUser();
	}
}
